package com.osdp.common.sercurity.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

@Service
public class AuthenticateServiceImpl extends DefaultAuthenticateService {

    @Override
    public Collection<String> getRoleCodes(Serializable principalId) {
        if(principalId instanceof String){
            List<String> roleCodes = null;// roleApi.getRoleCodes((String) principalId);
            if(CollectionUtils.isEmpty(roleCodes)){
                return Collections.emptyList();
            }
            return roleCodes;
        }
        return Collections.emptyList();
    }

    @Override
    public Collection<String> getPermissionCodes(Serializable principalId) {
        if(principalId instanceof String){
            List<String> permsCodes = null;// permissionApi.getPermissionCodes((String) principalId);
            if(CollectionUtils.isEmpty(permsCodes)){
                return Collections.emptyList();
            }
            return permsCodes;
        }
        return Collections.emptyList();
    }
}
